import request from "@/utils/request";

import type { GetCategoryList } from "@/api/product/model/categoryModel";

enum Api {
  getCategory1 = "/admin/product/getCategory1",
  getCategory2 = "/admin/product/getCategory2",
  getCategory3 = "/admin/product/getCategory3",
}

/**
 *
 * @returns
 */
//一级分类
export const getCategory1Api = () => {
  return request.get<any, GetCategoryList>(Api.getCategory1);
};
//二级分类
export const getCategory2Api = (category1Id: number) => {
  return request.get<any, GetCategoryList>(
    Api.getCategory2 + `/${category1Id}`
  );
};

//三级分类
export const getCategory3Api = (category2Id: number) => {
  return request.get<any, GetCategoryList>(
    Api.getCategory3 + `/${category2Id}`
  );
};
